﻿using System;
using System.Collections.Generic;

namespace NowWhoIsTheLuckyBoy
{
    class Program
    {
        static void Main(string[] args)
        {
            Random random = new Random();

            int count = -1;
            Console.WriteLine("请输入总人数: ");
            int.TryParse(Console.ReadLine(), out count);
            while (count <= 0)
            {
                Console.WriteLine("请输入一个大于零的整数！");
                int.TryParse(Console.ReadLine(), out count);
            }

            Console.WriteLine("请输入抽取人数:");
            int selected = -1;
            int.TryParse(Console.ReadLine(), out selected);
            while (selected <= 0)
            {
                Console.WriteLine("请输入一个大于零的整数！");
                int.TryParse(Console.ReadLine(), out selected);
            }

            List<int> all = new List<int>();
            for (int i = 0; i < count; i++)
            {
                all.Add(i + 1);
            }

            List<int> res = new List<int>();
            for (int i = 0; i < selected; i++)
            {
                int idnex = random.Next(0, all.Count);
                res.Add(all[idnex]);
                all.RemoveAt(idnex);
            }

            Console.WriteLine("中奖的序号是(序号从1开始)：");
            for (int i = 0; i < res.Count; i++)
            {
                Console.Write("{0}, ", res[i]);
            }

            Console.Read();
        }
    }
}
